Skip to content

Minor fix to Window.Java. #3192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

grissinibread
Copy link

Incorrect shell was being called in initial if statement.
Corrected to 'loopShell' which is the parameter created for this function.

Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the proposal. The code indeed looks wrong. It just seems to work because this method is only called at a single place where this.shell is passed as loopShell, such that both values are effectively always the same when reaching this line of code.

So I guess this is something you found by accident, but you did not experience any issues because of this, did you?

To improve this correction, I propose to do either of the following:

  • Make the method also static, as that's what it effectively is
  • Remove the loopShell parameter and directly reference shell

In addition to those, I propose to remove the null-check (and instead clarify in the contract that the argument is assumed to be non-null). This contract is currently fulfilled by the sole consumer of the method anyway, so no need for unnecessary null-checks and unused fallback mechanisms.

@grissinibread
Copy link
Author

I did in fact find this by accident while focusing on another issue! I also did not encounter any issues because of this. I went ahead and implemented your corrections/proposal, check it out and let me know if everything is in check 🤓

Thank you for checking out my proposal as well as the suggestions @HeikoKlare ☺️

@grissinibread grissinibread force-pushed the master branch 2 times, most recently from 2cb597b to 2821e0a Compare August 18, 2025 09:23
…ter and directly referenced shell. Updated the runEventLoop() contract for clarification.
@HeikoKlare HeikoKlare dismissed their stale review August 18, 2025 20:11

Resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants